package com.zhijian.medical.controller;

import com.zhijian.medical.annotation.Response;
import com.zhijian.medical.config.Constants;
import com.zhijian.medical.entity.vo.request.DictionarySearchVo;
import com.zhijian.medical.entity.vo.response.DictionaryVo;
import com.zhijian.medical.service.DictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author HCG
 * @version 1.0
 * @date 2022/9/2
 */
@Slf4j
@Controller
@Api(tags = "字典记录")
public class DictionaryController {

    @Autowired
    private DictionaryService dictionaryService;

    /**
     * 处理方式默认列表
     *
     * @return
     */
    @Response
    @GetMapping("/process/mode/list")
    @ApiOperation("处理方式默认列表")
    public List<DictionaryVo> selectProcessModeList() {
        return dictionaryService.selectList(DictionarySearchVo.builder()
                .type(Constants.DictionaryType.PROCESS_MODE)
                .build());
    }

    /**
     * 结果描述与检测结果默认列表
     *
     * @return
     */
    @Response
    @GetMapping("/result/description/list")
    @ApiOperation("结果描述与检测结果默认列表")
    public List<DictionaryVo> selectResultDescriptionList() {
        return dictionaryService.selectList(DictionarySearchVo.builder()
                .type(Constants.DictionaryType.RESULT_DESCRIPTION)
                .build());
    }

    /**
     * 根据类型获取对应的提示信息
     *
     * @return
     */
    @Response
    @GetMapping("/note")
    @ApiOperation("根据类型获取对应的提示信息")
    public DictionaryVo selectByType(@ApiParam(name = "type", value = "样本准备-肿瘤细胞比例说明:sample_ready_zlxbbl_note;" +
            "核酸提取-OD260/280说明:sample_hstq_od260280;" +
            "荧光PCR-核酸扩增一区-阴性室内质控-是否污染:pcr_hskzyq_yxsnzk_sfwr;" +
            "荧光PCR-核酸扩增一区-阴性室内质控-是否在控:pcr_hskzyq_yxsnzk_sfzk;" +
            "荧光PCR-核酸扩增一区-判定算法:pcr_algorithm;" +
            "一代测序-试剂配制区-体系一说明：sanger_sjpzq_tx1；" +
            "一代测序-试剂配制区-体系二说明：sanger_sjpzq_tx2；" +
            "一代测序-核酸纯化一区 （测序PCR试剂配制与加样）-测序PCR反应试剂说明：sanger_hscwyq2_cxpcrfysj；" +
            "二代测序-试剂配制区-试剂配制过程说明：ngs_sjpzq_sj；" +
            "一代测序or二代测序的反应孔位置填写说明：sanger_ngs_96")
                                     @RequestParam(value = "type") String type) {
        return dictionaryService.selectVoByType(type);
    }
}
